package com.chainyoung.component_tmmarket.mvp.presenter;


import com.chainyoung.common.base.CommonSubscriber;
import com.chainyoung.common.bean.UserInfo;
import com.chainyoung.common.di.scope.ActivityScope;
import com.chainyoung.common.mvp.BasePresenter;
import com.chainyoung.common.utils.RxUtils;
import com.chainyoung.component_tmmarket.bean.MarketCoupleList;
import com.chainyoung.component_tmmarket.bean.MarketList;
import com.chainyoung.component_tmmarket.mvp.contract.MarketMainContract;
import com.chainyoung.component_tmmarket.mvp.contract.SearchMarketListContract;

import java.util.TreeMap;

import javax.inject.Inject;

@ActivityScope
public class SearchMarketListPresenter extends BasePresenter<SearchMarketListContract.Model, SearchMarketListContract.View> {

    @Inject
    public SearchMarketListPresenter(SearchMarketListContract.Model model, SearchMarketListContract.View view) {
        super(model, view);
    }


    public void getMarketCoupleList(TreeMap<String, Object> map) {
        addSubscribe(
                mModel.getMarketCoupleList(map)
                        .compose(RxUtils.<MarketCoupleList>rxSchedulerHelper())
                        .subscribeWith(new CommonSubscriber<MarketCoupleList>(mView) {
                            @Override
                            public void onNext(MarketCoupleList data) {
                                mView.showMarketCurrencyCouples(data);
                            }
                        })
        );
    }

}
